package com.ruoyi.service.project.service.impl;


import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.service.project.entity.ProjectDeliveryEntity;
import com.ruoyi.service.project.enums.DeliveryStatusEnum;
import com.ruoyi.service.project.mapper.ProjectDeliveryMapper;
import com.ruoyi.service.project.service.ProjectDeliveryService;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 项目验收信息表 服务实现类
 * </p>
 *
 * @author Zane
 * @since 2025-10-18
 */
@Service
@RefreshScope
public class ProjectDeliveryServiceImpl extends
    ServiceImpl<ProjectDeliveryMapper, ProjectDeliveryEntity>
    implements ProjectDeliveryService {

/*  @Value("${kp.project.settle-project-limit-days:3}")
  private Integer settleProjectLimitDays;*/

  @Override
  public ProjectDeliveryEntity getUnVerifiedDelivery(String projectId) {
    final LambdaQueryWrapper<ProjectDeliveryEntity> query = queryWrapper()
        .eq(ProjectDeliveryEntity::getProjectId, projectId)
        .eq(ProjectDeliveryEntity::getVerifyStatus, DeliveryStatusEnum.WAITING);
    return getOne(query);
  }

//  @Override
//  public List<ProjectDeliveryEntity> getNeedSettleList() {
//    final LocalDateTime limitTime = LocalDateTime.now().minusDays(settleProjectLimitDays);
//    return list(queryWrapper()
//        .eq(ProjectDeliveryEntity::getVerifyStatus, DeliveryStatusEnum.PASS.getCode())
//        .isNotNull(ProjectDeliveryEntity::getVerifyTime)
//        .le(ProjectDeliveryEntity::getVerifyTime, limitTime));
//  }

  private LambdaQueryWrapper<ProjectDeliveryEntity> queryWrapper() {
    return new LambdaQueryWrapper<>();
  }

}
